<?php

namespace App\Http\Requests;

use Illuminate\Foundation\Http\FormRequest;

class CreateProjectRequest extends FormRequest
{
    /**
     * Determine if the user is authorized to make this request.
     *
     * @return bool
     */
    public function authorize()
    {
        return true;
    }

    /**
     * Get the validation rules that apply to the request.
     *
     * @return array
     */
    public function rules()
    {
        return [
            'name'=>'required|unique:projects,name',
            'thum'=>'image|dimensions:min_width=261,min_height=98'
        ];
    }

    //设置中文提示
    public function messages(){
        return [
            'name.required'=>'项目名称为必填项',
            'name.unique'=>'该名称已被使用',
            'thun.image'=>'请上传图片格式的文件',
            'thum.dimensions'=>'图片最小为261*98像素'
        ];
    }
}
